Skip to content

Conversation

@dhawalc
Copy link

@dhawalc dhawalc commented Feb 9, 2026

Migrates ignite/handlers/time_profilers.py from legacy typing syntax to Python 3.10+ union operators per #3481.

Changes

  • Union[A, B]A | B (function signatures, local variables, return types)
  • Dict[K, V]dict[K, V] (annotations throughout)
  • List[T]list[T] (annotations throughout)
  • Tuple[A, B]tuple[A, B] (annotations throughout)
  • Removed unused Dict, List, Tuple, Union imports from typing module
  • Kept Any, Callable, cast, Mapping, Sequence as they have no builtin equivalent

Both BasicTimeProfiler and HandlersTimeProfiler classes are updated.

Checklist

Migrates `ignite/handlers/time_profilers.py` from legacy typing syntax
to Python 3.10+ union operators per pytorch#3481.

Changes:
- `Union[A, B]` → `A | B`
- `Dict[K, V]` → `dict[K, V]`
- `List[T]` → `list[T]`
- `Tuple[A, B]` → `tuple[A, B]`
- Removed unused `Dict`, `List`, `Tuple`, `Union` imports from typing
@github-actions github-actions bot added the module: handlers Core Handlers module label Feb 9, 2026
import functools
from collections import OrderedDict
from typing import Any, Callable, cast, Dict, List, Mapping, Sequence, Tuple, Union
from typing import Any, Callable, cast, Mapping, Sequence
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also replace Mapping with dict in this file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: handlers Core Handlers module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants